package Study;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;

public class Demo7 {

    public static void main(String[] args) throws Exception {

        BufferedReader br = new BufferedReader (new FileReader ("c:/test.txt"));

//        String line = br.readLine ();

        String line;

        while ((line = br.readLine ()) != null) {
            System.out.println (line);
        }

        BufferedWriter bw = new BufferedWriter (new FileWriter ("c:/test.txt"));

        bw.append ("wo ce shi yi xia!");
        bw.newLine ();
        bw.append ("di er hang neng bu neng xie ru ");
        bw.newLine ();
        bw.write ("di san hang");


        String line2;
        while ((line2 = br.readLine ()) != null) {
            System.out.println (line2);
        }

        br.close ();
        bw.close ();


    }

}
